package com.example.shixunandjavagotoyangchen.BoosYang.Day002.Day002_1101;

import com.example.modelviewpresenter.Model.BasterModel;

import java.util.List;

import io.reactivex.Observer;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.disposables.Disposable;
import io.reactivex.schedulers.Schedulers;

/**
 * 作者:二徒
 * 时间：2021/11/2- 14:22
 * 功能实现：
 */
public class NingserDay002_1101Model extends BasterModel implements NingserDay002_1101Contion.moder {

    @Override
    public void getmoder(String name, NingserDay002_1101Callback callbck) {
        NingserDay002_1101Okhttp.getOkhttp().getRetrofit().create(NingserDay002_1101Api.class).getningser(name)
                .observeOn(AndroidSchedulers.mainThread())
                .subscribeOn(Schedulers.computation())
                .subscribe(new Observer<NingserDay002_1101Bean>() {
                    @Override
                    public void onSubscribe(Disposable d) {

                    }

                    @Override
                    public void onNext(NingserDay002_1101Bean ningserDay002_1101Bean) {
                        List<NingserDay002_1101Bean.ShujuBean> shujuBeans = ningserDay002_1101Bean.getShuju();
                        callbck.suees(shujuBeans);
                    }

                    @Override
                    public void onError(Throwable e) {
                        callbck.filai("失败"+e.toString());
                    }

                    @Override
                    public void onComplete() {

                    }
                });
    }



}
